include $(TOPDIR)/rules.mk

PKG_NAME:=luci-app-qosv4
PKG_VERSION:=1.1f
PKG_RELEASE:=1

include $(INCLUDE_DIR)/package.mk

define Package/luci-app-qosv4
SECTION:=LuCI
CATEGORY:=LuCI
SUBMENU:=3. Applications
TITLE:=LuCI Support for QoSv4.
DEPENDS:=+tc +iptables-mod-conntrack +iptables-mod-conntrack-extra +iptables-mod-filter +iptables-mod-imq +iptables-mod-ipopt +iptables-mod-nat +iptables-utils +iptables-mod-imq +kmod-sched
PKGARCH:=all
MAINTAINER:=qq 3341249
endef

define Package/luci-app-qosv4/description
An agent script that makes qosv4 configuration simple.
endef

define Build/Compile
endef

define Package/luci-app-qosv4/postinst
#!/bin/sh
( . /etc/uci-defaults/qosv4 ) && rm -f /etc/uci-defaults/qosv4
exit 0
endef

define Package/luci-app-qosv4/prerm
#!/bin/sh
/etc/init.d/qosv4 disable >/dev/null 2>&1
exit 0
endef

define Package/luci-app-qosv4/postrm
#!/bin/sh
uci -q batch <<-EOF >/dev/null
	delete ucitrack.@qosv4[-1]
	commit ucitrack
EOF
rm -f /tmp/luci-indexcache
rm -rf /tmp/luci-modulecache
exit 0
endef

define Package/luci-app-qosv4/install
	$(CP) ./files/* $(1)
	$(INSTALL_DIR) $(1)/usr/bin
	$(INSTALL_BIN) ./files/qosv4.bin $(1)/usr/bin/qosv4
	$(INSTALL_DIR) $(1)/etc/init.d
	$(INSTALL_BIN) ./files/qosv4.init $(1)/etc/init.d/qosv4
	$(INSTALL_DIR) $(1)/etc/config
	$(INSTALL_CONF) ./files/qosv4.config $(1)/etc/config/qosv4
	$(INSTALL_DIR) $(1)/etc/uci-defaults
	$(INSTALL_BIN) ./files/luci-qosv4.uci $(1)/etc/uci-defaults/luci-qosv4
endef

$(eval $(call BuildPackage,luci-app-qosv4))
